package com.itheima.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.common.R;
import com.itheima.domain.Order;
import com.itheima.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Slf4j
@RestController
@RequestMapping("order")
public class OrderController {


    @Autowired
    private OrderService orderService;

    @GetMapping("/page")
    public R<Page<Order>> pageSelect(@RequestParam(value = "id",required = false)String id, @RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize){
        log.info("page={},pageSize={},name={}", page, pageSize, id);
        return orderService.adminOrderPageSelect(id, page, pageSize);
    }

    @PutMapping
    public R<String> updateStatus(@RequestBody() Order order){
        log.info("修改订单的状态： order={}", order);
       return orderService.adminOrderUpdateStatus(order);

    }



}
